package com.eight;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @Description: 单点登录模块微服务（请在这里描述微服务的模块名字）
 * @Author: Van.Planifolia
 * @CreateTime: 2023-02-23  09:41
 * @Version: 1.0
 */
@SpringBootApplication()
// 开启Fein驱动
@EnableFeignClients
@MapperScan("com.eight.mapper")
public class SSOMain {
    public static void main(String[] args) {
        SpringApplication.run(SSOMain.class,args);
    }

    /**
     * 注册密码加密器
     * @return 密码加密器对象
     */
    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder(){
        return new BCryptPasswordEncoder();
    }

    /**
     * 注册Session
     * @return session注册机
     */
    @Bean
    public SessionRegistry sessionRegistry() {
        return new SessionRegistryImpl();
    }

}